package vmcs.common;

/**
 * Title:        VMCS
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:      ISS
 * @author Pang Pingli
 * @version 1.0
 */

import java.io
.*;
import java.util.*;


public class Environment {

  public final static String PROP_FILE = "/vmcs/propFile.txt";
  // property keys
  public final static String FILETYPE = "FileImpl";
  public final static String HARDWARETYPE = "HardwareImpl";
  public final static String DRINK_PROP_FILE = "drinkFile";
  public final static String CASH_PROP_FILE = "cashFile";
  public final static String PASSWORD = "password";

  public static Properties   prop;

  public Environment() {
  }

  public void initialize()
  throws VMCSException {

    try {
            Properties sysProp = System.getProperties();
            System.out.println("D:/KK/College/Sem II/OODP/trunk/VMCS/src" + PROP_FILE);
            String  fn = sysProp.getProperty("user.home") + "/workspace/VMCS/src"+ PROP_FILE;

            prop = new Properties();
            FileInputStream stream = new FileInputStream(fn);
            prop.load(stream);
            stream.close();
        } catch (Exception e) {
            throw new VMCSException("Environment.initialize", "Error loading environment properties: " + e);
        }
  }

  public static String   getDrinkPropFile(){
    return prop.getProperty(DRINK_PROP_FILE);
  }

  public static String   getCashPropFile(){
    String fn;
    fn = prop.getProperty(CASH_PROP_FILE);
    return fn;
  }

  // if you put password in the property file, the password is obtained here.
  public static String  getPassword(){
    return prop.getProperty(PASSWORD);
  }
}